package com.ruoyi.jksd.service.impl;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.jksd.mapper.XyBalanceLogMapper;
import com.ruoyi.jksd.domain.XyBalanceLog;
import com.ruoyi.jksd.service.IXyBalanceLogService;

/**
 * 会员-收支明细Service业务层处理
 *
 * @author ruoyi
 * @date 2024-05-26
 */
@Service
public class XyBalanceLogServiceImpl implements IXyBalanceLogService {
    @Autowired
    private XyBalanceLogMapper xyBalanceLogMapper;

    /**
     * 查询会员-收支明细
     *
     * @param id 会员-收支明细主键
     * @return 会员-收支明细
     */
    @Override
    public XyBalanceLog selectXyBalanceLogById(Long id) {
        return xyBalanceLogMapper.selectXyBalanceLogById(id);
    }

    /**
     * 查询会员-收支明细列表
     *
     * @param xyBalanceLog 会员-收支明细
     * @return 会员-收支明细
     */
    @Override
    public List<XyBalanceLog> selectXyBalanceLogList(XyBalanceLog xyBalanceLog) {
        return xyBalanceLogMapper.selectXyBalanceLogList(xyBalanceLog);
    }

    /**
     * 新增会员-收支明细
     *
     * @param xyBalanceLog 会员-收支明细
     * @return 结果
     */
    @Override
    public int insertXyBalanceLog(XyBalanceLog xyBalanceLog) {
        return xyBalanceLogMapper.insertXyBalanceLog(xyBalanceLog);
    }

    /**
     * 修改会员-收支明细
     *
     * @param xyBalanceLog 会员-收支明细
     * @return 结果
     */
    @Override
    public int updateXyBalanceLog(XyBalanceLog xyBalanceLog) {
        return xyBalanceLogMapper.updateXyBalanceLog(xyBalanceLog);
    }

    /**
     * 批量删除会员-收支明细
     *
     * @param ids 需要删除的会员-收支明细主键
     * @return 结果
     */
    @Override
    public int deleteXyBalanceLogByIds(Long[] ids) {
        return xyBalanceLogMapper.deleteXyBalanceLogByIds(ids);
    }

    /**
     * 删除会员-收支明细信息
     *
     * @param id 会员-收支明细主键
     * @return 结果
     */
    @Override
    public int deleteXyBalanceLogById(Long id) {
        return xyBalanceLogMapper.deleteXyBalanceLogById(id);
    }

    @Override
    public Map<String, String> countBalance(Long xyUserId) {
        String todyEarning = this.xyBalanceLogMapper.CountTodyBalanceLogList(xyUserId);
        String allEarning = this.xyBalanceLogMapper.CountAllBalanceLogList(xyUserId);
        Map<String, String> resMap = new HashMap<>();
        resMap.put("todyEarning", todyEarning);
        resMap.put("allEarning", allEarning);
        return resMap;
    }

    @Override
    public XyBalanceLog selectXyBalanceLogByOid(String oid) {
        return xyBalanceLogMapper.selectXyBalanceLogByOid(oid);
    }
}
